package blackithei.TCP;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;

public class ClientDemo2 {
    public static void main(String[] args) throws IOException {
        Socket so=new Socket("127.0.1",10001);
        OutputStream outputStream = so.getOutputStream();
        //写数据 字节
        outputStream.write("hello".getBytes());
        so.shutdownOutput();

        BufferedReader bf=new BufferedReader(new InputStreamReader(so.getInputStream()));
        String line;
        while((line=bf.readLine())!=null){
            System.out.println(line);
        }
        bf.close();
        outputStream.close();
        so.close();


    }
}
